//
//  CinemaViewController.m
//  UI20_豆瓣电影storyBoard
//
//  Created by 王阳阳 on 16/1/4.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CinemaViewController.h"
#import "cinemaTableViewCell.h"
#import "cinemaModel.h"
#import "NetWorkHandler.h"
@interface CinemaViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableview;
@property (nonatomic, strong)NSMutableArray *dataarr;
@end

@implementation CinemaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
       [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg.png"] forBarMetrics:UIBarMetricsDefault];
    [self data];
}

- (void)data
{
    
    NSString *str = @"http://project.lanou3g.com/teacher/yihuiyun/lanouproject/cinemalist.php";
    [NetWorkHandler GETWithURL:str completion:^(id result) {
        NSArray *arr = result[@"result"][@"data"];
        _dataarr = [cinemaModel modelHandlerWithArray:arr];
        [self.tableview reloadData];
    }];
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    cinemaTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cinemaModel *cinema = _dataarr[indexPath.row];
    cell.label3.text = cinema.telephone;
    cell.label2.text = cinema.address;
    cell.label1.text = cinema.cinemaName;
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 200;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
